import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
    name: 'subString'
})
export class SubStringPipe implements PipeTransform {
    transform(value: any, maxLen = 10, next = '...'): any {
        if (!value) {
            return null;
        }
        if (value.length > maxLen) {
            return value.substring(0, maxLen) + next;
        }
        return value;
    }
}
